﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;

namespace HelloWPF.Study.DataBinding.Validation
{
    public class DPValueValidationRule : ValidationRule
    {
        //value:需要验证的值  
        //返回值:
        public override ValidationResult Validate(object value, CultureInfo cultureInfo)
        {
            if (int.Parse(value.ToString()) > 200)
            {
                return new ValidationResult(false, "这个值不能大于200");
            }
            return new ValidationResult(true, "");
        }
    }
}
